Method for processing telephony sessions of a network

ABSTRACT

A method for processing telephony sessions of a network including at least one application server and a call router, the method including the steps of assigning a primary Uniform Resource Identifier (URI) and at least a secondary URI to an application; mapping a telephony session to the primary URI; communicating with the application server designated by the primary URI using an application layer protocol; receiving telephony instructions from the application server and processing the telephony instructions with the call router; detecting an application event; and upon detecting the application event, communicating with the application server designated by the secondary URI.

TECHNICAL FIELD

This invention relates generally to the telephony field, and more specifically to a new and useful method for processing telephony sessions in the telephony field.

BACKGROUND

In recent years, telephony applications have become more integrated with web applications. Telephony platforms have enabled web developers to apply their skill sets in the field of telephony. New products and services have been offered leveraging this new technical capability. However, integrating web applications with telephony services have introduced new problems to the field of telephony. In telephony applications, users have higher expectations and application errors are not expected or tolerated. In a telephone call there is less opportunities to signal to a user of an error. Companies providing telephony applications can lose customers during an application error. Additionally, applications are unable to be integrated with a telephone session. This places an increase burden on developers and limits the capabilities of telephony applications. Thus, there is a need in the telephony field to create a new and useful method for processing telephony sessions. This invention provides such a new and useful method.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is a schematic representation of a method of a preferred embodiment of the invention;

FIG. 2 is a schematic representation of a method of a preferred embodiment of the invention with a fallback URI;

FIG. 3 is a schematic representation of a method of a preferred embodiment of the invention with a status callback URI;

FIGS. 4A-4C are examples of a HTTP GET request, a HTTP POST request, and a HTTP GET request, respectively;

FIGS. 4D-4F are examples of a HTTP requests; and

FIGS. 5A and 5B are examples of XML responses.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The following description of the preferred embodiments of the invention is not intended to limit the invention to these preferred embodiments, but rather to enable any person skilled in the art to make and use this invention.

As shown in FIGS. 1 and 2, a method for processing telephony sessions of a preferred embodiment includes assigning a primary Uniform Resource Identifier (URI) and at least one secondary URI to an application S110; mapping a telephony session to the primary URI S120; communicating with the application server designated by the primary URI using an application layer protocol S130; receiving telephony instructions from the application server and processing the telephony instructions with the call router S140; detecting an application event S150; and upon detecting the application event, communicating with the application server designated by the secondary URI S160. The method functions to redirect program flow to secondary or backup applications. In one embodiment the method functions to handle and possibly recover from errors that occur during a session of a telephony application. For example, when an application error occurs, the secondary URI may be used as a fallback URI to take control of call control. In a second embodiment, the method functions to enable additional services to be updated during a call. For example, an outside service may store and process phone call recordings, and anytime a recording occurs on a telephony platform, the recording is sent to the outside service located at the secondary URI (i.e., a status callback URI). The method is preferably implemented within a telephony platform such as the one described in U.S. patent application Ser. No. 12/417,630, filed 2 Apr. 2009 and entitled “SYSTEM AND METHOD FOR PROCESSING TELEPHONY SESSIONS”, which is hereby incorporated in its entirety by this reference. The method may, however, alternatively be implemented on any suitable system. The method is preferably used in systems that operate on a distributed system. For example, the telephony platform is preferably separate from the application server(s) hosting a specific application. An application event may be an application error, a state change during a telephony session, a particular telephony instruction or user action, or any suitable event. An application error could occur in communication between the telephony platform and the application server(s). Alternatively, application error may be customer error such as when the application server sends improperly formed or illegal instructions to the telephony platform. State change of a telephony session may alternatively be an application event that triggers communication with a status callback URI. The secondary URI may be to a server operated by the same entity as the application server or it may be an outside third-party service or any suitable server application. A status callback URI preferably does not alter the state of the telephony session but can be used as a supplementary tool for providing data to other services during a session. The method may be used for voice-based, short message service (SMS)-based, multimedia messaging service (MMS)-based, fax-based, or any suitable telephony network based communication.

Step S110, which includes assigning a primary Uniform Resource Identifier (URI) and at least a secondary URI to an application, functions to specify a URI for handling typical telephony application handling and a URI for handling a telephony application during a communication failure. The primary and secondary URIs are preferably universal resource locators (URL) that point to an application server or servers of the application operator. The primary URI and secondary URI may alternatively be any suitable address to resources of the telephony application. The URIs may be set within a settings interface for an application administrator. The URIs may alternatively be resources on a telephony platform for a particular telephony application. These resources are preferably accessible through an application programming interface (API) such as the API described in U.S. patent application Ser. No. 12/417,630. The primary URI preferably includes a default value of an initial URI. The initial URI is used for a new telephony session. This initial URI is preferably associated with an assigned telephony address (e.g., a phone number, SMS long code, SMS short code, etc.) that is used in determining what application server to manage a call. For example, when an incoming call is made to a phone number of an application, the initial URI associated with the phone number is used as the primary URI for the first communication message sent to the application server. The primary URI is preferably updated during a telephony session during the communication with the application. For example, a telephony command may be sent to the telephony platform instructing the telephony platform to gather the pressed digits during a phone call and to return the results to a new URI. The primary URI will preferably change to the new URI after the results are gathered. At the end of a telephony session the primary URI is preferably reset to the default initial URI. The primary URI may alternatively remain unchanged from the initial URI. The secondary URI as described may be an address to any suitable service. In one variation, the secondary URI is a fallback URI that preferably addresses error handling code/logic. The fallback URI is preferably hosted on a different application server in case the application server of the primary URI fails. In a second variation, the secondary URI is a status callback URI that preferably addresses a service that acts as a supplementary destination for telephony session data as shown in FIG. 3. Status callback URIs may be used for sending transcripts, recordings, telephony session call flow, numbers dialed, and/or any suitable aspect of a telephony session. A status callback URI is preferably registered for particular type of state change in a telephony session such as the ending of a recording, but may alternatively be for a plurality of types of events such as the start and end of any recording, transcription, and button input. These may be registered for all instances of an application or be registered during a particular telephony session of an application. They may be registered through telephony instructions, through an API, and/or through any suitable method. There may be a plurality of secondary URIs. One variation may allow specific errors or failures to be associated with specific fallback URIs. Another variation preferably uses multiple fallback URIs as redundant backups. For example, if after a primary URI fails a fallback URI is used, and if the fallback URI fails then the next fallback URI is used. Additionally, multiple status callback URIs may be used. A variety of third-party services may be used, each with a status callback URI for different events of a telephony application. Status Callback URIs, and fallback URIs may additionally be used in the same application, such that each application would be capable of providing status callbacks to various services and providing error handling code.

Step S120, which includes mapping a telephony session to the primary URI, functions to enable a telephony session to be converted into a format that may be handled with standard web servers and web applications. The mapping is preferably performed using a call router. An initial URI (e.g., default primary URI) is preferably pre-specified at the call router by a web application (which may be running on a third party server) or call router account owner. More preferably, the initial URI is assigned to the call via a unique identifier for the call destination, such as a DID (Direct Inbound Dial) phone number, or a VOIP SIP address. The URI may alternatively be specified by a remote server or other suitable device or method. In one variation, the URI may be used to encapsulate state information or a portion of state information from the initiated telephony session, such as the originating phone number, the dialed phone number, the date and time of the call, geographic location of the caller (e.g. country, city, state, and/or zip), and/or the unique call ID. The information included in the URI may be included in the form of a URI template. For example the URI default template could be: http://demo.twilio.com/myapp/{dialed phone number}/{originating phone number} or http://demo.twilio.com/myapp/foo.php?dialed_number={dialed phone number}& originating_number={originating phone number}.

Step S130, which includes communicating with the application server designated by the primary URI using an application layer protocol, functions to send and receive messages between the call router/telephony platform and the application server. The application control of a telephony session preferably occurs through the communication with the application server. The communication preferably includes the sending of requests to the application server; after the application server processes the request, receiving a response; and processing the response.

Preferably, a telephony session request is sent to the primary URI. During the initial request sent to the application, the default initial URI is preferably used. The request is preferably sent to a server over a network. In one variation, the request is sent to a local server on a local area network. In another variation, the request is sent to a server running locally on the device originating the call. In yet another variation, the request may be sent to multiple servers. The request preferably encapsulates at least a portion of the state information from the initiated telephony session, such as the originating phone number, the dialed phone number, the date and time of the call, geographic location of the caller (e.g. country, city, and/or state, zip), and/or the unique call ID. The request, more preferably, encapsulates all the state information of the call, but may alternatively include no state information or partial state information. The state information from the initiated telephony session is preferably sent via HTTP POST in the request body, HTTP GET in the request URI, HTTP header parameters to mimic the data flow of a web browser, or by any combination or suitable alternative way. If new state information is generated in the course of the operation of the call router, a request to the application server is preferably made to communicate the new state and to request new telephony instructions. Preferably, new state information is not kept or acted upon internally by the call router, but is passed to the application server for processing. Alternatively, partial state information is preferably stored on the call router until a fully updated state is achieved, and then communicated to the application server. For example, the application server may specify that multiple digits should be pressed on the keypad, not just one, before new call state is derived and communicated to the application server. In one variation, the information from the initiated telephone session may be a web-form submission included in the HTTP POST request. The request may include any state information from the telephony session, such as the originating phone number, the dialed phone number, the date and time of the call, and/or the unique call ID, the current status of the phone call (pending, in-progress, completed, etc.), or the results of a telephony action, including Dual Tone Multi Frequency (DTMF) digit processing, or a representation of or a link to a sound recording, or the status of the last command, or other call state. Examples of a HTTP GET request, a HTTP POST request, and a HTTP GET request are shown in FIGS. 4A, 4B, and 4C, respectively. Further examples of HTTP communication used for SMS messaging are shown in FIGS. 4D, 4E, and 4F. The HTTP request (or any suitable request communication) to the server preferably observes the principles of a RESTful design. RESTful is understood in this document to describe a Representational State Transfer architecture as is known in the art. The RESTful HTTP requests are preferably stateless, thus each message communicated from the call router to the application server preferably contains all necessary information for operation of the application server and response generation of the application server. The call router and/or the application server preferably do not need to remember or store previous communications to be aware of the state. Documents, media, and application state are preferably viewed as addressable resources, combined with data provide to the resource via request parameter, such as HTTP GET or HTTP POST parameters, or request body contents. Such request data may include an updated representation of the call resource, or other call state data generated as a result of call router operation, such as digits pressed on the keypad or audio recordings generated. State information included with each request may include a unique call identifier, call status data such as whether the call is in-progress or completed, the caller ID of the caller, the phone number called, geographic data about the callers, and/or any suitable data. However, a varying level of a RESTful communication (statelessness) may be used, such as by using cookies, session tracking, or any suitable devices to simulate a normal website visitor model. Preferably, data sent with each request may fully enable the application server to determine the next state of the call to execute. RESTfulness preferably does not preclude using external datasource, such as a database, to lookup additional data to log call meta data, or determine application logic.

The application server will preferably process the request and send a response to the call router. Thus Step S130 would include receiving a response from the application server. This response is preferably an HTTP response. The response is preferably sent as XML, audio binary, or raw text, but may alternatively be any sort of messaging format, including HTML, delimited text, key/value text or binary encoded format. The HTTP response preferably includes directions to perform telephony actions. The response may alternatively or additionally include a new URI or a new URI template to use as the primary URI with the telephony action in Step S140. An additional example XML response is shown in FIGS. 5A and 5B.

Step S140, which includes receiving telephony instructions from the application server and processing the telephony instructions with the call router, functions to convert the server response into telephony actions or executable operations during a telephony session. The telephony actions may include, for example, playing a pre-recorded sound file at a server-specified URI (such as a static mp3 file located at http://demo.twilio.com/myapp/1234.mp3), reading text to the caller using text-to-speech technology, calling another number (such as creating a new voice connection through the PSTN, SIP/VoIP, or other IP technology system), collecting digits via DTMF input, recording voice response audio, TTY or other inputs, sending an SMS message, or any suitable combination or sequence of these or other suitable actions. This conversion of the server response is preferably performed at a call router. Preferably, Step S120 includes processing the response mime-types associated with the server response. For example, if the response mime-type is XML, it is considered to be a set of call router instructions. If the response mime-type is MP3, it is considered a sound file to be played for the caller. If the response type is plain text, it is considered to be text to be read, via Text-To-Speech, to the caller.

Contents of the server response, such as an XML document, are preferably converted into a telephony action by processing the document sequentially (e.g. line by line). Telephony instructions are preferably contained within the document in the form of a markup language, such as XML as shown in FIGS. 5A and 5B. This sequential approach to processing a document of telephony instructions is enabled when the communication is stateless and all the necessary information is contained within the URI. This stateless communication preferably allows telephony instructions (verbs or commands) to be used as the programming interface for a server application performing telephony services. Algorithmic interpretation (based on the state of the communication) of the telephony verbs or the document is preferably not necessary. The telephony actions are preferably executed in the order of telephony instructions found in the contents of the server response. For example, an XML document may include the necessary verbs to carry out the telephony actions of reading text to a caller, monitoring keys pressed by the caller, and redirecting the caller to a new URI (i.e., an updated primary URI) using the pressed keys as part of the data within the new URI. Preferably, the telephony action (such as digits pressed) results in new state information, which may result in a repetition of some steps of the method, preferably beginning at Steps S120 or S130. The next URI is preferably provided by the server as part of the processing instructions. In another variation, the last URI is reused if the server fails to specify a next URI. In yet another variation, no repetition occurs if the server fails to specify a next URI, and processing continues below at the next call router instruction. The behavior may be determined by the nature of the call router instruction; for example, instructions that generate no new state information would not need to have a next URI since they don't trigger communication with a remote server. New state information may trigger an application event for the state change of the telephony session. A secondary URI and more specifically a status callback URI is preferably registered for a type of state change such as recording beginning or recording end. When a secondary URI is registered for a particular state change then that state change will be detected in Step S150. The telephony actions preferably result in the repetition of step S130 with the new URI resulting from Step S140, but may alternatively initiate a repetition of one or more steps of the method. Step S130 is preferably repeated using all new phone session state information resulting from execution of a telephony action, such as digits pressed, a recorded audio file, or the success or failure of any telephony action requested. Repetition also includes all state information that remains relevant during the course of the session, such as Caller, Called, unique Call ID, and call status. The state information may also be represented in the form of a URI Template. For example, if the server response specifies that the call router should collect DTMF digits, and specifies that the next URL is the URI Template http://demo.twilio.com/foo.php?digits={Digits}, and the caller presses 1234, the resulting URI is http://demo.twilio.com/foo.php?digits=1234. Similarly, if the server response specifies the URI Template: http://demo.twilio.com/myapp/{Digits}.mp3, the resulting HTTP Request could be to a static mp3 file located at: http://demo.twilio.com/myapp/1234.mp3. Thus, a call may be controlled by one server that issued the telephony instruction and a second server that processes the response. Such call control hand-offs constitute the transfer of state information between servers in the form of a URI and accompanying request data, such as GET, POST, and/or request body. Preferably, all state communications conform to a syntax established by the call router to facilitate integration between multiple servers. For example, digits pressed on the keypad are preferably communicated to application servers in an identical fashion, thus minimizing the need for coordination between a multiple application servers with regard to how state is transferred. Alternatively, call router instructions may dictate the method of communicating new state information, such as the names and types of variables to send representing new state.

Step S150, which includes detecting an application event, functions to identify a trigger for use of a secondary URI. The application event may be an application error, a state change during a telephony session such as a particular telephony instruction or user action, or any suitable event. Detecting an application error functions to determine if the communication for a telephony application has encountered failure or fatal error. In one variation, the application error is a communication error. A communication error is preferably an inability to properly communicate with the application server. This may occur if the application server is not operating as shown in FIG. 1. When the call router is attempting to send a request to the application server specified by the primary URI, a server error message is returned indicating a communication error has occurred. As another variation, the application error may be customer error. Customer error is an error in the operation of the telephony application due to malformed or improper messages from the application server as shown in FIG. 2. This will commonly include syntax errors in the code of the application server. They may respond to a request with invalid or unparsable instructions. Other application errors may be any suitable error that occurs in a telephony application. The application event may alternatively be a state change such as a state change during a telephony session, a particular telephony instruction or user action, and/or any suitable event. State changes may include the start, end or changes in telephony sessions for transcripts, recordings, telephony session call flow, numbers dialed, buttons pressed, and/or any suitable aspect of a telephony session. A status callback URI may be registered for a particular type of event such as the ending of a recording, but may alternatively be for a plurality of types of events such as the start and end of any recording, transcription, and button input. Such events are preferably detected during the execution of the telephony instructions as described above, from user input, or through any suitable indicator of the state change.

Step S160, which includes communicating with the application server designated by the secondary URI upon application event, functions to use the secondary URI for handling aspects of the event. When application event triggers a secondary URI that is a fallback URI, the communication is preferably intended to handle an application error. When the secondary URI is a status callback URI, data related to the event is preferably sent to the service specified by the status callback URI. As mentioned above a plurality of secondary URIs may be assigned for an application. There may be a plurality of fallback URIs and/or a plurality of status callback URIs.

A fallback URI may be used to catch errors and recover or to gracefully inform a user in the telephony session of an error. Information about the telephony session is preferably included in the communication with the application server designated by the secondary URI. In one variation, the request last sent to the application server is preferably resent to the application server of the secondary URI. This will preferably include the same HTTP parameters, and may additionally include HTTP errors. Similar to how state is embedded in communication using the primary URI, state of the application at the time of the application error may be embedded in the secondary URI. The request may encapsulate at least a portion of the state information from the initiated telephony session, such as the originating phone number, the dialed phone number, the date and time of the call, geographic location of the caller (e.g. country, city, and/or state, zip), and/or the unique call ID. The request, more preferably, encapsulates all the state information of the call, but may alternatively include no state information or partial state information. The state information from the initiated telephony session is preferably sent via HTTP POST in the request body, HTTP GET in the request URI, HTTP header parameters to mimic the data flow of a web browser, or by any combination or suitable alternative way. Using the state information an application server may be capable of recovering the application state and proceed without ending a telephony session or starting over. In this variation, the fallback URI may result in communication that updates the primary URI. Or in other words, the telephony application may recover and continue with normal operation. Alternatively, a notification of the error may simply be sent to the secondary URI and a static response (e.g., an audio message informing user of the error) may be generically returned and played to the user before ending the call.

In the case of the communication error, the secondary URI is preferably hosted on a different server than that of the primary URI. The server of the secondary URI will ideally be operating even if the server of the primary URI stops operating. The server of the secondary URI may include a mirror or duplicate instance of the server of the primary URI. Thus when a communication error occurs control of the application may be moved over to the server of the secondary URI and proceed with normal operation from the perspective of the user without ending the telephony session.

In the case of customer error, the application server has provided malformed or improper messages from the application server or the application server has caused the telephony platform to halt execution of the telephony application. Similar to the communication error, the state information may be used to recover. However, the state information may alternatively be logged and used by the application developer in resolving errors in the application. Additionally, if the secondary URI fails another secondary URI may be used. Alternatively, a default error handling routine may be used within the telephony session. For example, a default message of the telephony platform may be played.

In the case of a state change application event, a telephony instruction, user action, or other indicator of the state change preferably has an associated status callback URI. Data associated with the state change is preferably communicated to an application server specified by the status callback URI. This status callback server may be operated by the same entity as the main application server, but may alternatively be operated by a third-party. The status callback server preferably receives the data and performs any suitable action. A reply is preferably not part of the communication, but continued communication between the telephony platform (e.g., call router) and the status callback server may occur. Preferably, the communication. In this variation, the telephony session is preferably uninterrupted, and the communication with the application server of the secondary URI (e.g., the status callback URI) happens in parallel to the communication with the application server of the primary URI. Some exemplary applications of a status callback URI would be to send data relating to audio recordings, transcriptions, telephony session call flow, numbers dialed, and/or any suitable aspect of a telephony session to a second application.

An alternative embodiment preferably implements the above methods in a computer-readable medium storing computer-readable instructions. The instructions are preferably executed by computer-executable components preferably integrated with a telephony platform preferably with a call router to mediate communication between telephony devices and an application server. The computer-readable medium may be stored on any suitable computer readable media such as RAMs, ROMs, flash memory, EEPROMs, optical devices (CD or DVD), hard drives, floppy drives, or any suitable device. The computer-executable component is preferably a processor but the instructions may alternatively or additionally be executed by any suitable dedicated hardware device.

As a person skilled in the art will recognize from the previous detailed description and from the figures and claims, modifications and changes can be made to the preferred embodiments of the invention without departing from the scope of this invention defined in the following claims. 

We claim:
 1. A method for processing telephony sessions of a network including at least one application server and a call router, the method comprising the steps of: assigning a primary Uniform Resource Identifier (URI) and at least a secondary URI to an application; mapping a telephony session to the primary URI; communicating with the application server designated by the primary URI using an application layer protocol, wherein communicating with the application server comprises embedding state information of the telephony session in a first application layer protocol request, sending the first request through an application layer protocol to an application server designated by the primary URI, and receiving telephony instructions in a first application layer protocol response from the application server; processing the telephony instructions into telephony actions of the telephony session; detecting an application event; and upon detecting the application event, embedding state information of the telephony session and application event in a second application layer protocol request; sending the second request through an application layer protocol to an application server designated by the secondary URI.
 2. The method of claim 1, wherein during the step of communicating with the application server designated by the primary URI, the primary URI may be updated through the communication from the application server.
 3. The method of claim 1, further including the step of embedding state information of the telephony session into the primary URI used for sending the request.
 4. The method of claim 1, wherein the application event is an application error.
 5. The method of claim 4, wherein the application error is a communication error when communicating with the application server designated by the prima URI.
 6. The method of claim 5, wherein the secondary URI references a second application server.
 7. The method of claim 4, wherein the application error is customer error of invalid telephony instructions in the first application layer protocol response.
 8. The method of claim 1, further comprising upon application error in communication with the secondary URI, using a default error handling routine within the telephony session.
 9. The method of claim 1, wherein the secondary URI assigned to an application is assigned to a type of state change in a telephony session of the application; and wherein the application event is the type of state change in the telephony session.
 10. The method of claim 9, wherein assigning at least a secondary URI to an application includes registering the secondary URI as a status callback URI for a type of state change in a telephony session; and wherein communicating with the application server designated by the secondary URI includes sending data associated with the registered event to a server of the status callback URI in parallel to communicating with the application server designated by the primary URI.
 11. The method of claim 10, wherein a status callback URI may be registered for a plurality of types of state changes in a telephony session.
 12. The method of claim 1, wherein at least two secondary URIs are assigned, one secondary URI assigned for an application error event and the second secondary URI being a status callback URI for a state change in the telephony session.
 13. The method of claim 1, wherein the steps of sending and receiving are performed using a Hypertext Transfer Protocol (HTTP).
 14. The method of claim 1, further including the step of initiating the telephony session from a phone number through the Public Switched Telephone Network (PSTN).
 15. The method of claim 1, further including the step of initiating the telephony session from a message received from a Short Message Service (SMS) system.
 16. The method of claim 1, further comprising creating call router resources accessible through a call router Application Programming Interface (API), wherein the primary URI and secondary URI are call router resources.
 17. The method of claim 1, wherein embedding state information of the telephony session and application event in a second application layer protocol request comprises embedding the state information in the secondary URI of the second request.
 18. The method of claim 4, wherein the state information of the telephony session and application event embedded in the second application layer protocol request includes an error identifier.
 19. The method of claim 4, wherein the state information of the telephony session and application event embedded in the second application layer protocol request includes telephony state information from the time of the error and an error identifier.
 20. The method of claim 1, wherein state information of the session comprises an originating phone number of the session, a destination phone number of the session, and a unique session identifier.
 21. The method of claim 1, further comprising receiving a response of the application server designated by the secondary URI, wherein the response of the application server of the secondary URI includes a second set of telephony instructions; and processing the second set of telephony instructions into telephony actions of the session.
 22. The method of claim 21, wherein processing the second set of telephony instructions into telephony actions of the session comprises updating the primary URI of the session.
 23. A method for processing telephony sessions of a network comprising: assigning a primary Uniform Resource Identifier (URI) to an telephony application; assigning an application error URI to the telephony application; assigning a status callback URI to a type of state change in a telephony session of the telephony application; mapping a telephony session to the primary URI; communicating with an application server designated by the primary URI using an application layer protocol, wherein communicating with the application server comprises embedding state information of the telephony session in a first application layer protocol request, sending the first request through an application layer protocol to an application server designated by the primary URI, and receiving the telephony instructions in a first application layer protocol response from the application server; processing the telephony instructions into telephony actions of the session, wherein processing the telephony instructions comprises updating the primary URI of the session and communicating with an application server designated by the updated primary URI; detecting an application error during the telephony session; communicating with a second application server designated by the application error URI, wherein communicating with the second application server comprises embedding state information of the telephony session and an application error identifier in a second application layer protocol request, sending the second request to the second application server through the application layer protocol, and receiving a second set of telephony instructions in a second application layer protocol response from the second application server; processing the second set of telephony instructions into telephony actions of the session comprising updating the primary URI of the session and communicating with an application server designated by the updated primary URI; detecting an application state event during the telephony session; and upon detecting the application state event of the type assigned to the status callback URI, communicating with a third application server designated by the status callback URI in parallel to communicating with the application server designated by the primary URI, wherein communicating with the third application server comprises embedding state information of the telephony session at the time of the application state event in a third application layer protocol request and sending the third request to the third application server. 